/*
 * @lc app=leetcode.cn id=412 lang=javascript
 *
 * [412] Fizz Buzz
 */

// @lc code=start
/**
 * @param {number} n
 * @return {string[]}
 */
var fizzBuzz = function (n) {
  const answer = [];

  for (let i = 1; i <= n; i++) {
    answer.push(String(i));

    if (i % 15 === 0) {
      answer[i - 1] = 'FizzBuzz';
    } else if (i % 3 === 0) {
      answer[i - 1] = 'Fizz';
    } else if (i % 5 === 0) {
      answer[i - 1] = 'Buzz';
    }
  }

  return answer;
};
// @lc code=end

// @after-stub-for-debug-begin
module.exports = fizzBuzz;
// @after-stub-for-debug-end
